local skel = fk.CreateSkill {
  name = "emo__rumeng",
  tags = {Skill.Compulsory},
  dynamic_desc = function (self, player, lang)
    if player:usedSkillTimes("emo__maoxian", Player.HistoryGame) > 0 then
      return "emo__rumeng_wake"
    end
  end,
}


skel:addEffect(fk.Damaged, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player
  end,
  trigger_times = function (self, event, target, player, data)
    return data.damage
  end,
  on_cost = function (self, event, target, player, data)
    return player:usedSkillTimes("emo__maoxian", Player.HistoryGame) == 0 or player.room:askToSkillInvoke(player, {
      skill_name = skel.name, prompt = "#emo__rumeng-invoke",
    })
  end,
  on_use = function (self, event, target, player, data)
    player:turnOver()
  end,
})

skel:addEffect(fk.TurnEnd, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player
  end,
  on_cost = function (self, event, target, player, data)
    return player:usedSkillTimes("emo__maoxian", Player.HistoryGame) == 0 or player.room:askToSkillInvoke(player, {
      skill_name = skel.name, prompt = "#emo__rumeng-invoke",
    })
  end,
  on_use = function (self, event, target, player, data)
    player:turnOver()
  end,
})


Fk:loadTranslationTable{
  ["emo__rumeng"] = "入梦",
  [":emo__rumeng"] = "锁定技，当你受到1点伤害后，或回合结束时，你翻面。",

  [":emo__rumeng_wake"] = "锁定技，当你受到1点伤害后，或回合结束时，你可以翻面。",
  ["#emo__rumeng-invoke"] = "入梦：你可以翻面！",
}

return skel
